<%@ page import="com.webamc.common.enums.Fields" %>
<%@ page import="com.webamc.common.enums.Params" %>
<%@ page import="com.webamc.model.ProductOrder" %>
<%@ page import="java.util.List" %>
<%@ page import="static com.webamc.util.CommonUtil.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<link rel="stylesheet" href="../webamc.css"/>
<div class="action-header">INSTALLATIONS</div>
<%
    final List<ProductOrder> list = (List) request.getAttribute(Params.BEAN);
    if (list == null || list.size() == 0) {
%><p class="header-divsmall">No Results to display. <a href="productorder.html?action=beforeCreate">click here</a> to
    create.</p>
<% return;
}
%>
<jsp:include page="msgs.jsp"/>

<table class="browse-table" border="1">
    <thead>
        <tr>
            <th>OrderId</th>
            <th>Status</th>
            <th>Product Name</th>
            <th>Product Serial</th>
            <th>Invoice Number</th>
            <th>Invoice Date</th>
            <th>Customer Id</th>
            <th>Installation Date</th>
            <th>Create Date</th>
            <th>Warranty</th>
            <th>Ext Warranty</th>
            <th>Assignee</th>
            <th>Supervisior</th>
            <th>LastUpdated</th>
        </tr>
    </thead>
    <tbody>
        <%
            boolean even = true;
            for (ProductOrder order : list) {
                even = !even;
        %>
        <tr class="<%=even?"rowone":"rowtwo"%>">
            <td>
                <a href="productorder.html?action=view&<%=Fields.ORDERID%>=<%=order.getOrderId()%>">
                    <%=order.getOrderId()%>
                </a>
            </td>
            <td><%=out(order.getStatus())%>
            </td>
            <td>
                <%=out(order.getProductName())%>
            </td>
            <td><%=out(order.getProductSerial())%>
            </td>
            <td><%=order.getInvoiceNumber()%>
            </td>
            <td><%=getDateString(order.getInvoiceDate())%>)
            </td>
            <td>
                <a href="customer.html?action=view&<%=Fields.CUSTOMERID%>=<%=order.getCustomerId()%>">
                    <%=order.getCustomerId()%>
                </a>
            </td>
            <td><%=getDateString(order.getInstallationDate())%>
            </td>
            <td><%=getDateString(order.getCreateDate())%>
            </td>
            <td><%=order.getWarranty()%>
            </td>
            <td><%=order.getExtWarranty()%>
            </td>
            <td>
                <a href="user.html?action=view&<%=Fields.USERID%>=<%=order.getAssigneeId()%>">
                    <%=order.getAssigneeId()%>
                </a>
            </td>
            <td>
                <a href="user.html?action=view&<%=Fields.USERID%>=<%=order.getSupervisorId()%>">
                    <%=order.getSupervisorId()%>
                </a>
            </td>
            <td><%=getDateString(order.getLastUpdated())%>
            </td>
        </tr>
        <%}%>
    </tbody>
</table>
